package gold.digger;

import gold.utils.InputUtil;

import java.util.*;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC884 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public String[] uncommonFromSentences(String s1, String s2) {
            Map<String, Integer> map = new HashMap<>();
            String str = s1 + " " + s2;
            String[] ss = str.split(" ");
            for (String s : ss) map.put(s, map.getOrDefault(s, 0) + 1);
            List<String> list = new ArrayList<>();
            for (String s : map.keySet()) if (map.get(s) == 1) list.add(s);
            return list.toArray(new String[list.size()]);
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(Arrays.toString(solution.uncommonFromSentences("this apple is sweet", "this apple is sour")));
    }

    public static void main(String[] args) throws Exception {
        LC884 an = new LC884();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
